package com.zzptc.sky.baidudemo.fragments;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Toast;

import com.zzptc.sky.baidudemo.R;
import com.zzptc.sky.baidudemo.activities.SOSForSelectContactsActivity;
import com.zzptc.sky.baidudemo.adapter.SOSForSelectShowContactsAdapter;
import com.zzptc.sky.baidudemo.base.BaseFragment;
import com.zzptc.sky.baidudemo.base.BaseFragmentsForSOS;
import com.zzptc.sky.baidudemo.utils.MyApplication;
import com.zzptc.sky.baidudemo.utils.MyUntils;
import com.zzptc.sky.baidudemo.vo.ContactsInfo;
import com.zzptc.sky.baidudemo.vo.ContactsInfo2;

import java.util.List;

/**
 * Created by Administrator on 2017/6/5.
 */

public class SOSForSelectContactsFragment extends BaseFragmentsForSOS {

    private RecyclerView rv_fragment_showdata;

    @Override
    public int getFragmentXml() {
        return R.layout.fragment_sos_selectcontacts;
    }

    @Override
    public void initView() {
        rv_fragment_showdata = (RecyclerView) getThisView().findViewById(R.id.rv_fragment_showdata);
    }

    @Override
    public void initData() {
//        List<ContactsInfo2> list = MyUntils.getAllContacts2();
//        SOSForSelectShowContactsAdapter adapter = new SOSForSelectShowContactsAdapter(list);
        List<ContactsInfo> list = MyApplication.getContactsList();
        if (list == null){
            Toast.makeText(getActivity(), "尚未查询完", Toast.LENGTH_SHORT).show();
            return;
        }
        SOSForSelectShowContactsAdapter adapter = new SOSForSelectShowContactsAdapter(list);
        rv_fragment_showdata.setLayoutManager(new LinearLayoutManager(getActivity()));
        rv_fragment_showdata.setAdapter(adapter);
    }
}
